#!/bin/sh
# Simple standalone build script for building and testing yadxdiag

if [ ! -d "output" ]; then
    mkdir output
fi

echo "CLEAN_BUILD_TEST: Cleaning previous build..." && \
    rm -rf dxdiag.txt output/msdxdiag.txt output/yadxdiag.txt && make clean && \
echo "CLEAN_BUILD_TEST: Building..." && \
    make && \
echo "CLEAN_BUILD_TEST: Running MS DxDiag to generate benchmark output file in TXT..." && \
    wine dxdiag -T output/msdxdiag.txt && \
echo "CLEAN_BUILD_TEST: Running yadxdiag to generate project output file in TXT..." && \
    wine dxdiag.exe.so -T output/yadxdiag.txt && \
echo "CLEAN_BUILD_TEST: Running file comparison tests in TXT..." && \
    ruby tests/test_output.rb output/msdxdiag.txt output/yadxdiag.txt |egrep -i "not matched|failed|not found|$" && \
echo "CLEAN_BUILD_TEST: Running MS DxDiag to generate benchmark output file in XML..." && \
    wine dxdiag -X output/msdxdiag.xml && \	
echo "CLEAN_BUILD_TEST: Running yadxdiag to generate project output file in XML..." && \
    wine dxdiag.exe.so -X output/yadxdiag.xml && \
echo "CLEAN_BUILD_TEST: Running file comparison tests in XML..." && \
    ruby tests/ComparisonTest.rb -x -both output/msdxdiag.xml output/yadxdiag.xml && \	
echo "CLEAN_BUILD_TEST: Running yadxdiag in window mode..." && \
    wine dxdiag.exe.so
